package com.tansun.easycare.rule.rulegroup.model;

import java.util.ArrayList;
import java.util.List;

import com.tansun.easycare.rule.rulegroup.entity.RuleEntry;
import com.tansun.easycare.rule.rulegroup.entity.RuleGroup;

public class RuleEntryVO {

    private RuleEntry ruleEntry;
    
    private List<RuleEntryCondition> conditions;
    
    private List<RuleGroup> rules;

    
    public RuleEntryVO(RuleEntry ruleEntry, List<RuleGroup> rules) {
		super();
		this.ruleEntry = ruleEntry;
		String accessMode = ruleEntry.getAccessMode();
		if(RuleEntry.ACCESSMODEL_WEIGHT_1.equals(accessMode)) {
			this.conditions = RuleEntryCondition.newInstance(ruleEntry.getConditions(),false);
		}
		this.rules = rules;
	}

	public List<RuleGroup> getRules() {
    	if(rules==null)
    		rules = new ArrayList<>();
        return rules;
    }

    public void setRules(List<RuleGroup> rules) {
        this.rules = rules;
    }

	public RuleEntry getRuleEntry() {
		return ruleEntry;
	}

	public void setRuleEntry(RuleEntry ruleEntry) {
		this.ruleEntry = ruleEntry;
	}

	public List<RuleEntryCondition> getConditions() {
		return conditions;
	}

	public void setConditions(List<RuleEntryCondition> conditions) {
		this.conditions = conditions;
	}

}
